import React from 'react';
import request from 'umi-request';

const urlMap = {
    cascader:
        'https://vv-tech-public-bucket.oss-cn-hongkong.aliyuncs.com/1603448609472df4442c1-efc4-41c8-a426-cc62e2de4ab0_cascaderData.json',
    china:
        'https://vv-tech-public-bucket.oss-cn-hongkong.aliyuncs.com/16037675883174ea8fd4e-4a58-48fd-8ff1-68a58dd398e8_china.json',
    asian:
        'https://vv-tech-public-bucket.oss-cn-hongkong.aliyuncs.com/1603767624692138505aa-4f94-4c78-bf63-7ead0e5a2100_asian.json',
    area:
        'https://vv-tech-public-bucket.oss-cn-hongkong.aliyuncs.com/1603448707219415799d3-b3eb-4ba8-ac5a-4821a8063d35_area.json'
};

export default function useMapData(type) {
    const [data, setData] = React.useState([]);
    React.useEffect(() => {
        request(urlMap[type]).then(result => {
            setData(result);
        });
    }, []);
    return [data];
}
